package com.grj.park.test;

import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ParkingApplicationCompleteListener implements TaskListener {

    private static final Logger logger = LoggerFactory.getLogger(ParkingApplicationCompleteListener.class);

    @Autowired
    private ParkingApplicationListener parkingApplicationListener;

    @Override
    public void notify(DelegateTask delegateTask) {
        // 获取申请状态
        boolean approved = (boolean) delegateTask.getVariable("approved");

        if (!approved) {
            // 获取用户ID和任务ID
            String userId = (String) delegateTask.getVariable("userId");

            logger.info("拒绝邮件已发送给用户: {}", userId);
        }else{
            logger.info("通过邮件已发送给用户");
        }
    }
}
